package fr.lox.fall.main;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

import fr.lox.fall.common.Map;
import fr.lox.fall.common.Player;

public class Game implements ApplicationListener {
	private SpriteBatch batch;
	private Player p;
	private Map mp;
	
	@Override
	public void create() {		

		batch = new SpriteBatch();
		p = new Player(20f);
		mp = new Map();
		Gdx.input.setInputProcessor(p);
	}

	@Override
	public void dispose() {
		batch.dispose();
		p.dispose();
	}

	@Override
	public void render() {		
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		
		batch.begin();
			mp.draw(batch);
			p.update();
			p.draw(batch);
		batch.end();
	}

	@Override
	public void resize(int width, int height) {
		p.resize(width, height);
		this.mp.resize(width, height);
	}

	@Override
	public void pause() {
	}

	@Override
	public void resume() {
	}
}
